package com.yupi.yupicturebackend.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

@Getter
public enum ReviewPictureEnum {

    NORMAL("正常", "Normal"),
    PORN("色情", "Porn"),
    ADS("广告", "Ads");
    private final String text;

    private final String value;




    /**
     * @param text 文本
     * @param value 值
     *
     */
    ReviewPictureEnum(String text, String value) {
        this.text = text;
        this.value = value;

    }

    /**
     * 根据 value 获取枚举
     */
    public static ReviewPictureEnum getEnumByValue(String  value) {
        if (ObjUtil.isEmpty(value)) {
            return null;
        }
        for (ReviewPictureEnum reviewPictureEnum : ReviewPictureEnum.values()) {
            if (reviewPictureEnum.value.equals(value)) {
                return reviewPictureEnum;
            }
        }
        return null;
    }
}
